﻿using DataBase.DBmodels;
using DataBase.Utils;
using GreenXi.Help;
using GreenXi.Help.Curve;
using GreenXi.Model;
using GreenXi.Pages.Power;
using Microsoft.EntityFrameworkCore;
using PressSystem_Can.Help.Can;
using Prism.Commands;
using System;
using System.Collections.ObjectModel;
using System.Linq;

namespace GreenXi.ViewModel
{
    public class PressureCurveViewModel : PressureCurveModel
    {
        public static PressureCurve context;


      


        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            //填充数据
       
            ListError = new (GlobalVariables.ErrorMenuList);
            //填充数据
            IsPolice = GlobalVariables.CallPolice == 0 ? false : true;
            PoliceStr = GlobalVariables.PoliceStr;


            #region ZedGraph 初始化
            SmoothChart.Init(context.zedGraphControl1, "1", GlobalVariables.Cylinder1No, GlobalVariables.ListPress);

            CraftList = new(GlobalVariables.CraftViewList.Where(X=>X.Type==3).Take(10));
            CraftList2 = new(GlobalVariables.CraftViewList2.Take(4));
            CraftList3 = new(GlobalVariables.CraftViewList3.Take(7));
            #endregion
        }

        public PressureCurveViewModel()
        { }

        public PressureCurveViewModel(PressureCurve _context)
        {
            context = _context;
            Init(); //初始化
            SwitchButton1 = new DelegateCommand(() =>
            {
                SwitchButton_Click();
            });
        }

        private void SwitchButton_Click()
        {
          
        }
    }
}
